
from time import sleep
from concurrent.futures.thread import ThreadPoolExecutor

from utils.handler import MethodHandler
from utils.log import Log


class MyClass(Log):
    @MethodHandler()
    def f(self):
        sleep(3)
        self.info('f done')
        return 42

    @MethodHandler()
    def g(self):
        self.info('g done')
        return 1


def main():
    my_class = MyClass()
    pool = ThreadPoolExecutor(max_workers=5)
    pool.submit(my_class.f)
    pool.submit(my_class.f)
    pool.submit(my_class.f)
    pool.submit(my_class.f)
    pool.submit(my_class.g)
    pool.shutdown()


if __name__ == '__main__':
    main()
